package ch.fhnw.qualiscan.api.output;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

import ch.fhnw.qualiscan.Config;
import ch.fhnw.qualiscan.core.db.pojos.Survey;

@XmlRootElement
@XmlType(propOrder = { "link", "id", "title", "creationDate", "completionDate", "university"})
public class SurveyOutput {
	
	Survey survey;
	
	public SurveyOutput() {}
	
	public SurveyOutput(Survey survey) {
		this.survey = survey;
	}
	
	@XmlElement
    public int getId() {
        return this.survey.getId();
    }
	
	@XmlElement
    public String getTitle() {
        return this.survey.getTitle();
    }
	
	@XmlElement
    public String getCreationDate() {
        return this.survey.getCreationdate().toString();
    }
	
	@XmlElement
    public String getCompletionDate() {
        return this.survey.getCompletiondate().toString();
    }
	
	@XmlElement
    public String getUniversity() {
        return this.survey.getUniversity().getTitle();
    }
	
	@XmlElement 
	public String getLink() {
		return Config.API_URL + "surveys/" + this.survey.getId();
	}
	
}
